package com.amm.gwt.gwtgaeuploader.client.event;

import com.google.gwt.event.shared.GwtEvent;

public class MyEvent extends GwtEvent<MyEventHandler> {

    public static enum MyEventAction {
        IMAGE_SAVED, ERROR
    }

    public static Type<MyEventHandler> TYPE = new Type<MyEventHandler>();

    private MyEventAction action;

    private String servingUrl;

    public MyEvent(MyEventAction action, String servingUrl) {
        this.action = action;
        this.servingUrl = servingUrl;
    }

    public String getServingUrl() {
        return servingUrl;
    }

    public MyEventAction getAction() {
        return action;
    }

    @Override
    public Type<MyEventHandler> getAssociatedType() {
        return TYPE;
    }

    @Override
    protected void dispatch(MyEventHandler handler) {
        handler.onMyEvent(this);
    }

}